home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / Anim Cursor.cpt / CursorAnimation.c < prev    next >
C/C++ Source or Header  |  1990-01-24  |  4KB  |  96 lines

  1. /************************************************************************/
  2. /*                                                                        */
  3. /*    CursorAnimation.c                                                    */
  4. /*                                                                        */
  5. /*        -- cursor animation demo exec for Lightspeed C (V 4.0)            */
  6. /*                                                                        */
  7. /*            Coded by Eric H. Seale, based on some Lightspeed Pascal     */
  8. /*            code by Yasser Farra and Chris Reed (but more about that    */
  9. /*            later...).                                                    */
  10. /*                                                                        */
  11. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
  12. /*                                                                        */
  13. /*    First, the original "hello" from Yasser Farra's Pascal code:        */
  14. /*                                                                        */
  15. /*    This demo test shows how to use a beach ball cursor with Lightspeed    */
  16. /*    Pascal.  This program and the accompanying cursor control unit have    */
  17. /*    been modified from a unit I downloaded from a network one day.  I     */
  18. /*    would like to give credit to Chris Reed of San Angelo, Texas.          */
  19. /*    Because he asked not to distribute modified copies of his work, I'm    */
  20. /*    uploading this as mine.  I needed to use the routines in my         */
  21. /*    application, but some modifications were necessary to make them        */
  22. /*    commercially sound, especially exception handling.  Mr. Reed's         */
  23. /*    routines would crash if the "acur" or related  resources were not    */
  24. /*    in the resource file or could not be loaded.  Also, his routines     */
  25. /*    used SetUpA5 and RestoreA5 routines which are buggy (tech note 208).*/
  26. /*    Finally, my routines accept the speed of animation as a parameter,    */
  27. /*    and can be used with any valid "acur" resource as long as it         */
  28. /*    contains the IDs of all related "CURS" resources and those             */
  29. /*    resources are in the resource file also.  Please use these routines    */
  30. /*    as you please and if you'd like some other hints or helpful            */
  31. /*    examples drop me a memo.                                            */
  32. /*                                                                        */
  33. /*    Yasser Farra                                                        */
  34. /*    Box 7351                                                            */
  35. /*    Austin, TX 78713                                                    */
  36. /*    AppleLink: D3002                                                    */
  37. /*    GEnie: Y.FARRA                                                        */
  38. /*                                                                        */
  39. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
  40. /*                                                                        */
  41. /*    Now my turn:                                                        */
  42. /*                                                                        */
  43. /*    I found the included Pascal code sitting all by it's lonesome on    */
  44. /*    the nets one day, and I thought to myself -- "Gee, that's neat, but    */
  45. /*    what about us poor C hackers?  Are we stuck with bland-looking         */
  46. /*    applications?"  WRONG, bit-breath!  And so, a few (+) hours later,    */
  47. /*    this nifty set of routines suddenly appeared in a "C" version.        */
  48. /*                                                                        */
  49. /*    Basically, I just translated Yasser's code into C, and documented    */
  50. /*    things 'till I was blue in the face.  I also renamed his routines    */
  51. /*    (actually, Apple's code -- from Tech Note 208) that replace            */
  52. /*    SetupA5 and RestoreA5 -- more on this in the routine code.  Oh,        */
  53. /*    yes -- I also added some additional acurs and CURS resources (to be    */
  54. /*    honest, I snitched them from MacUsers' Hypercard Toolbox stack).    */
  55. /*    This demo has the choice of the following acurs:                    */
  56. /*                                                                        */
  57. /*        0 -- Beachball (in Yasser's stuff)                                */
  58. /*        1 -- Paint gun                                                    */
  59. /*        2 -- Running movie                                                */
  60. /*                                                                        */
  61. /*    I coded this up using V4.0 of Symantec's THINK C™, so if you use    */
  62. /*    another compiler, or an earlier version of THINK C™, just throw out    */
  63. /*    the project file, and compile the source.                            */
  64. /*                                                                        */
  65. /*    Feel free to contact me, too, if you'd like.                        */
  66. /*                                                                        */
  67. /*    Eric Seale                                                            */
  68. /*    P.O. Box 620352                                                        */
  69. /*    Littleton, CO  80162                                                */
  70. /*    America Online:    MisterBee                                            */
  71. /*    GENIE:            E.H.Seale                                            */
  72. /*                                                                        */
  73. /************************************************************************/
  74.  
  75.  
  76.  
  77. #define beachBall    0
  78. #define    paintGun    1
  79. #define    movieStrip    2
  80.  
  81.  
  82.  
  83. main()
  84. {
  85.     InitCursAnimation(movieStrip);
  86.         /* Change the passed parameter for desired effect                     */
  87.         /* If "acur" resource, or the associated "CURS" resources are not     */
  88.         /*    found, the standard non-animated watch cursor will be used        */
  89.                             
  90.     AnimateCursor(6);        /* Number of ticks between consecutive frames */
  91.  
  92.     /* Do some processing here */
  93.     while (!Button());
  94.  
  95.     StopCursor();
  96. }